{ INFORMATICS.MCCME.RU
  Problem statement: http://informatics.mccme.ru/moodle/mod/statements/view3.php?chapterid=3075
  Verdict: Accepted
}
uses SysUtils, Math;
 
var
	n,i,ans,a,b:int64;
 
begin
reset(input,'input.txt');
rewrite(output,'output.txt');
read(n);
a:=1;
b:=1;
ans:=1;
i:=1;
while ans<n do begin
	ans:=a+b;
	a:=b;
	b:=ans;
	inc(i);
end;
if ans=n then write(i+1) else write(-1); 
end.